package cn.yunhe.service;

import cn.yunhe.entity.Book;
import cn.yunhe.util.SessionFactoryUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2018/4/13.
 */
public class BookService {
    SqlSession session= SessionFactoryUtil.getSession();
    public List<Book> getAllBook(Book book){
        List<Book> list=new ArrayList<Book>();
        list=session.selectList("cn.yunhe.Dao.BookDao.getAllBook",book);
        return list;
    }
    public int addBook(Book book){
        int result=session.insert("cn.yunhe.Dao.BookDao.addBook",book);
        session.commit();
        session.close();
        return result;
    }
}
